(function(jq) {
	jq(function() {
		jq(".selectPermission").each(function() {
			var selectPermissionDiv=jq(this);
			var dialog = selectPermissionDiv.find(".dialog").dialog({
				autoOpen : false
			});
			selectPermissionDiv.find(".icon").click(function() {
				dialog.dialog("open");
			});
			dialog.delegate(".treeItem", "click", function(event) {
				var treeItem = jq(this);
				var valueDisplayName = treeItem.find(".treeItemDisplayName").text();
				var valueId = treeItem.find(".treeItemValueId").text();
				selectPermissionDiv.find(".displayNameSelect").val(valueDisplayName);
				selectPermissionDiv.find(".valueIdSelect").val(valueId);
				event.preventDefault();
			});
		});
	});
})(jQuery);